<template>
  <div>
    <el-button @click="login"> 登录 </el-button>
  </div>
</template>

<script setup lang="ts">
import useUserStore from '@/stores/modules/user'
import { useRouter } from 'vue-router'
const router = useRouter()
const login = () => {
  useUserStore()
    .login({
      name: 'admin',
      password: '11111'
    })
    .then(() => {
      console.log('登录成功')
      router.push({ path: '/' })
    })
}
</script>

<style scoped lang="scss"></style>
